package cn.wolfcode.qo;

import cn.hutool.core.date.DateUtil;
import cn.wolfcode.enums.ConsumptionReportEnum;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @Author chenhui
 * @Date 2021/1/17 10:12
 **/
@Setter
@Getter
public class ConsumptionReportQueryObject extends QueryObject {
    private String groupType = ConsumptionReportEnum.BUSINESS.getValue(); //分组类型
    private Long businessId; //门店id
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDate;
    private Boolean appointmentType; //预约类型

    public Date getEndDate(){
        if(endDate!=null){
            //设置为当天的最晚的时间
            return DateUtil.endOfDay(endDate);
        }
        return null;
    }
}
